package com.example.gymmanagebackend.service.impl;

import com.example.gymmanagebackend.mapper.EvaluateMapper;
import com.example.gymmanagebackend.pojo.Evaluate;
import com.example.gymmanagebackend.service.EvaluateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;

@Service
public class EvaluateServiceImpl implements EvaluateService {

    @Autowired
    private EvaluateMapper evaluateMapper;

    @Override
    public int addEvaluate(Evaluate evaluate) {
        return evaluateMapper.addEvaluate(evaluate);
    }

    @Override
    public int deleteEvaluateById(int id) {
        return evaluateMapper.deleteEvaluateById(id);
    }

    @Override
    public int updateEvaluate(Evaluate evaluate) {
        return evaluateMapper.updateEvaluate(evaluate);
    }

    @Override
    public List<Evaluate> getAllEvaluates() {
        return evaluateMapper.getAllEvaluates();
    }

    @Override
    public Evaluate getEvaluateById(int id) {
        return evaluateMapper.getEvaluateById(id);
    }
    @Override
    public List<Evaluate> getEvaluateSubmission() {
        return evaluateMapper.getEvaluateSubmission();
    }
    @Override
    public List<Evaluate> getEvaluateSubmissionWithPagination(int page, int size) {
        int offset = (page - 1) * size;
        return evaluateMapper.getEvaluateSubmissionWithPagination(offset, size);
    }

    @Override
    public int countEvaluate() {
        return evaluateMapper.countEvaluate();
    }
    @Override
    public List<Map<String, Object>> getEvaluateRatingDistribution() {
        return evaluateMapper.getEvaluateRatingDistribution();
    }

    @Override
    public List<Map<String, Object>> getTopEvaluateContents() {
        return evaluateMapper.getTopEvaluateContents();
    }
}
